Skip to content

feat(sandbox): store default sandbox in profile#142

Open
Ramon Nogueira (ramon-langchain) wants to merge 2 commits into
mainfrom
ramonn/default-sandbox-profile
Open

feat(sandbox): store default sandbox in profile#142
Ramon Nogueira (ramon-langchain) wants to merge 2 commits into
mainfrom
ramonn/default-sandbox-profile

Conversation

@ramon-langchain
Copy link
Copy Markdown
Member

Summary

Store the current sandbox on the active profile and use it when sandbox commands omit the sandbox name.

  • add default_sandbox to saved profiles
  • set the profile default after sandbox create
  • allow sandbox commands to fall back to the profile default
  • include sandbox/snapshot names in status-style messages

Test Plan

  • go test ./...

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Comment on lines +214 to +216
if err := setDefaultSandboxName(cmd, defaultName); err != nil {
return nil, fmt.Errorf("setting default sandbox: %w", err)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 sandbox create returns error and hides successful creation when config write fails

In sandboxCreateCommand.Action, after the sandbox is successfully created on the server via c.SDK.Sandboxes.Boxes.New(), the code calls setDefaultSandboxName() to persist the default sandbox name to the config file. If this config write fails (e.g., read-only filesystem, disk full, corrupted config), the action returns (nil, err). Because the structured.Command framework at internal/structured/command.go:28-29 checks if err != nil { return err } before rendering, the successfully created sandbox's details (name, ID, status) are never shown to the user. The user sees only an error like setting default sandbox: ... and may not realize the sandbox was created, potentially retrying and creating duplicates or leaving an orphaned sandbox they can't identify.

Suggested change
if err := setDefaultSandboxName(cmd, defaultName); err != nil {
return nil, fmt.Errorf("setting default sandbox: %w", err)
}
if err := setDefaultSandboxName(cmd, defaultName); err != nil {
fmt.Fprintf(os.Stderr, "warning: could not set default sandbox: %v\n", err)
}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant